home *** CD-ROM | disk | FTP | other *** search
- #include <ezycom.h>
- #include <ezylib.h>
- #include <stdio.h>
-
- // UserRecord is 0 based
- // MsgBoard is 1 based
- // MsgNumber is 1 based
-
- word GetNextRead(FILE *hLastComb,word UserRecord,word MsgBoard)
- {
- word NextRead;
- fseek(hLastComb,(((longint)UserRecord * (longint)(Constant.MaxMess / 16)) +
- (longint)((MsgBoard - 1) / 16)) * sizeof(UsersLastRecord) +
- (longint)(((MsgBoard - 1) % 16) * 2) + 2,SEEK_SET);
- if (fread(&NextRead,sizeof(word),1,hLastComb) == 0)
- NextRead = 0;
- return(NextRead);
- }
-
- int PutNextRead(FILE *hLastComb,word UserRecord,word MsgBoard,word MsgNumber)
- {
- int Success = FALSE;
- if ((MsgBoard <= Constant.MaxMess) && (MsgBoard > 0)) {
- fseek(hLastComb,(((longint)UserRecord * (longint)(Constant.MaxMess / 16)) +
- (longint)((MsgBoard - 1) / 16)) * (longint)sizeof(UsersLastRecord) +
- (longint)(((MsgBoard - 1) % 16) * 2) + 2,SEEK_SET);
- if (fwrite(&MsgNumber,sizeof(word),1,hLastComb) == 1)
- Success = TRUE;
- }
- return(Success);
- }
-
-